package com.dx.architectureddd.common.task;

import lombok.Getter;
import org.springframework.scheduling.config.Task;

/**
 * 自定义定时任务
 *
 * @author xin.deng
 * @date 2023/10/14
 */
@Getter
public class ScheduledTasks extends Task implements Runnable {

    /**
     * 任务id
     */
    private Long taskId;

    /**
     * cron表达式
     */
    private String cronStr;

    public ScheduledTasks(Runnable runnable, Long taskId, String cronStr) {
        super(runnable);
        this.taskId = taskId;
        this.cronStr = cronStr;
    }

    @Override
    public void run() {
        getRunnable().run();
    }
}
